import { Entity, ManyToOne, PrimaryKey, Property } from "@mikro-orm/core";
import { BaseEntity } from "./Base";
import { Location } from "./Location";

@Entity()
export class Store extends BaseEntity {
  @Property()
  name: string;

  @Property()
  sales: number;

  //   @Property({ nullable: true })
  //   location!: number;

  @ManyToOne({
    entity: () => Location,
    joinColumn: "location_id",
    referenceColumnName: "id",
    nullable: true,
  })
  locationId!: number;

  constructor(name: string, sales: number) {
    super();
    this.name = name;
    this.sales = sales;
  }
}
